package com.demo.config;

import java.util.List;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.demo.base.resolver.CurrentUserResolver;
import com.demo.base.resolver.ParamArgValidorResolver;

@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {
    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
        argumentResolvers.add(currentUserResolver());
        argumentResolvers.add(paramArgValidorResolver());
    }

    @Bean
    public ParamArgValidorResolver paramArgValidorResolver() {
        return new ParamArgValidorResolver();
    }
    
    @Bean
    public CurrentUserResolver currentUserResolver() {
        return new CurrentUserResolver();
    }
}